@inherits BasePlugin
@rendermode InteractiveServer

<PluginBody Title="Users List">
    <ActionsFragment>
        <ActionButtonCreate Href="@GetUrl("Create User")" Label="Add User" />
    </ActionsFragment>
    <ChildContent>
        <DataTable Items="Users">
            <DataTableItem Label="UserName">@context.Username</DataTableItem>
            <DataTableItem Label="First Name">@context.FirstName</DataTableItem>
            <DataTableItem Label="Last Name">@context.LastName</DataTableItem>
            <DataTableItem Label="Email">@context.Email</DataTableItem>
            <DataTableItem Label="Email Confirmed">
                <Indicator Color="Color.Success" Visible="@context.EmailConfirmed">YES</Indicator>
                <Indicator Color="Color.Danger" Visible="@(!context.EmailConfirmed)">NO</Indicator>
            </DataTableItem>
            <DataTableItem Label="Phone">@context.PhoneNumber</DataTableItem>
            <DataTableItem Label="Phone Confirmed">
                <Indicator Color="Color.Success" Visible="@context.PhoneConfirmed">YES</Indicator>
                <Indicator Color="Color.Danger" Visible="@(!context.PhoneConfirmed)">NO</Indicator>
            </DataTableItem>
            <DataTableItem Label="Enable">
                <Indicator Color="Color.Success" Visible="@context.Enabled">YES</Indicator>
                <Indicator Color="Color.Danger" Visible="@(!context.Enabled)">NO</Indicator>
            </DataTableItem>
            <DataTableItem Label="Level">
                <Indicator Color="Color.Success" Visible="@context.IsSuperAdmin">SuperAdmin</Indicator>
            </DataTableItem>
            <DataTableItem Label="Create Date">@context.CreatedAt</DataTableItem>
            <DataTableItem Label="Last Login Date">@context.LoginAt</DataTableItem>
            <DataTableItem Label="Login Count">@context.LoginCount</DataTableItem>
            <DataTableItem Label="Locked">
                <Indicator Color="Color.Success" Visible="@(!context.Locked)">NO</Indicator>
                <Indicator Color="Color.Danger" Visible="@context.Locked">YES</Indicator>
            </DataTableItem>
            <ActionButtons>
                <ActionButtonDelete @onclick="() => OnConfirm(context)" Visible="@(!context.IsSuperAdmin)" />
                <ActionButtonEdit Href="@GetUrl("Update User", new { id = @context.Id })" />
            </ActionButtons>
        </DataTable>
    </ChildContent>
</PluginBody>

<Confirm OnConfirm="OnDelete" OnCancel="OnConfirmClose" Visible="SelectedUser != null">
    Are you sure to delete <b>"@SelectedUser!.Username"</b> role?
</Confirm>
